home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 476-500 / disk_498 / wordsearch / src / wordsearch.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  3KB  |  105 lines

  1. #include <stdio.h>
  2. #include <exec/types.h>
  3. #include <exec/libraries.h>
  4. #include "wsearch.h"
  5. #include "interface.h"
  6. #include "funcs.h"
  7. #include <libraries/ReqBase.h>
  8.  
  9. char word[MAXWORD][MAXSIZE+1];
  10. char *puzzle=NULL, *key=NULL, *display=NULL;
  11.  
  12. int px=PXINIT,py=PYINIT,w,filter=255,rot=1;
  13. BOOL LWActive=FALSE, DispKey = TRUE;
  14.  
  15. void main()
  16.  {
  17.    BOOL close_me;
  18.  
  19.     if(init()==FALSE) goto finish;
  20.  
  21.     if(Dimensions()==FALSE) goto finish;
  22.     NewKey();
  23.     NewPuzzle();
  24.     NewDisplay();
  25.     Msg.Class = NEWSIZE;
  26.     puzdisplay();
  27.  
  28.     close_me = FALSE;
  29.  
  30.     while( close_me == FALSE )
  31.      {
  32.         Wait((1 << WLWin->UserPort->mp_SigBit)|
  33.              (1 << DPWin->UserPort->mp_SigBit));
  34.         IMsg=(struct IntuiMessage *)GetMsg(WLWin->UserPort);
  35.         while(IMsg)
  36.          {
  37.             Msg.Class = IMsg->Class;
  38.             Msg.IAddress = IMsg->IAddress;
  39.             Msg.Code = IMsg->Code;
  40.         
  41.         if(Msg.Class==MENUVERIFY && Msg.Code==MENUHOT)
  42.         /* this code is currently disable since it can lock on a menu
  43.            selection and changing it clear all pending messages */
  44.         {
  45.         if(LastWord->Flags|SELECTED!=0)
  46.             LWActive=TRUE;
  47.         else
  48.             LWActive=FALSE;
  49.         }    
  50.             
  51.         ReplyMsg( IMsg );
  52.  
  53.             if(Msg.Class == MENUPICK)
  54.                 menuctrl();
  55.             else if(Msg.Class == CLOSEWINDOW)
  56.                 close_me = TRUE;
  57.             else
  58.                 wordlist();
  59.             while(IMsg=(struct IntuiMessage *)GetMsg(WLWin->UserPort))
  60.             {
  61.                 if(IMsg->Class!=MOUSEMOVE) break;
  62.                 ReplyMsg(IMsg);/* Purge excessive MOUSEMOVE cmds */
  63.             }
  64.           }
  65.         IMsg=(struct IntuiMessage *)GetMsg(DPWin->UserPort);
  66.         while(IMsg)
  67.          {
  68.             Msg.Class = IMsg->Class;
  69.             Msg.Code = IMsg->Code;
  70.             ReplyMsg( IMsg );
  71.         
  72.         LWActive = FALSE;
  73.         
  74.             if(Msg.Class == MENUPICK)
  75.                 menuctrl();
  76.             else if(Msg.Class == CLOSEWINDOW)
  77.                 close_me = TRUE;
  78.             else
  79.                 puzdisplay();
  80.             while(IMsg=(struct IntuiMessage *)GetMsg(DPWin->UserPort))
  81.             {
  82.                 if(IMsg->Class!=MOUSEMOVE) break;
  83.                 ReplyMsg(IMsg);/* Purge excessive MOUSEMOVE cmds */
  84.             }
  85.           }
  86.      }
  87.  
  88.     finish:
  89.         if(WLWin!=NULL)
  90.         {
  91.                 ClearMenuStrip(WLWin);
  92.                 CloseWindow(WLWin);
  93.         }
  94.         if(DPWin!=NULL)
  95.         {
  96.                 ClearMenuStrip(DPWin);
  97.                 CloseWindow(DPWin);
  98.         }
  99.         if(IntuitionBase!=NULL) CloseLibrary(IntuitionBase);
  100.         if(ReqBase!=NULL) CloseLibrary(ReqBase);
  101.         if(GfxBase!=NULL) CloseLibrary(GfxBase);
  102.     return;
  103.  }
  104.  
  105.